//
//  LSHomeDataManager.m
//  听说弱点强化训练
//
//  Created by 盛超 on 2018/8/18.
//  Copyright © 2018年 盛超. All rights reserved.
//

#import "LSHomeDataManager.h"

@implementation LSHomeDataManager

- (NSString *)requestUrl {
    return @"api/ZXYYTS/W_ZXYYTS_GetWeakInfo";
    //return @"api/ZXYYTS/W_ZXYYTS_GetWeakInfo_Two";
}

- (void)requestWithCompltionSuccess:(void (^)(LSModelHome *))success failuer:(void (^)(NSString *))failure {
    
    [self requestGetMethodWithSuccess:^(id responseObject) {
        
        NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
        NSLog(@"%@",[NSObject objectToJson:dict]);
        LSModelHome *home = [LSModelHome yy_modelWithDictionary:dict];
        success(home);
        
    } Failure:^(NSError *error) {
        
        failure(error.localizedDescription);
        
    }];
}

- (void)updateWithCompltionSuccess:(void (^)(LSModelHome *))success failuer:(void (^)(NSString *))failure {
    self.requestUrl = @"api/ZXYYTS/W_ZXYYTS_UpdateWeakInfo";
    [self requestGetMethodWithSuccess:^(id responseObject) {
        
        NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
        NSLog(@"弱点=%@",[NSObject objectToJson:dict]);
        LSModelHome *home = [LSModelHome yy_modelWithDictionary:dict];
        success(home);
        
    } Failure:^(NSError *error) {
        
        failure(error.localizedDescription);
        
    }];
}

@end
